/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @website https://el-admin.vip
* @description /
* @author admin
* @date 2020-09-23
**/
@Entity
@Data
@Table(name="fh_per_record")
public class FhPerRecord implements Serializable {

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "user_id")
    @ApiModelProperty(value = "用户id")
    private String userId;

    @Column(name = "user_name")
    @ApiModelProperty(value = "用户名")
    private String userName;

    @Column(name = "method")
    @ApiModelProperty(value = "开门方式")
    private Integer method;

    @Column(name = "status")
    @ApiModelProperty(value = "是否开启")
    private Integer status;

    @Column(name = "card_count")
    @ApiModelProperty(value = "卡号")
    private String cardCount;

    @Column(name = "img")
    @ApiModelProperty(value = "采集图片")
    private String img;

    @Column(name = "time")
    @ApiModelProperty(value = "时间")
    private String time;

    @Column(name = "device")
    @ApiModelProperty(value = "设备序号")
    private String device;

    @Column(name = "device_name")
    @ApiModelProperty(value = "设备名称")
    private String deviceName;

    @Column(name = "create_time")
    @CreationTimestamp
    @ApiModelProperty(value = "创建时间")
    private Timestamp createTime;

    public void copy(FhPerRecord source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}